// 辅助函数：将日期格式化为年月日
function formatDate(date) {
	const year = date.getFullYear();
	const month = date.getMonth() + 1;
	const day = date.getDate();
	return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
}

// 辅助函数：获取明天的日期
function getNextDayFormatted(date) {
	const nextDay = new Date(date);
	nextDay.setDate(nextDay.getDate() + 1);
	return formatDate(nextDay);
}


export function compareDate(dateString) {
	const today = new Date();
	const targetDate = new Date(dateString);

	// 将日期转换为年月日格式，以便比较
	const todayFormatted = formatDate(today);
	const targetDateFormatted = formatDate(targetDate);

	if (targetDateFormatted === todayFormatted) {
		return '今天';
	} else if (targetDateFormatted === getNextDayFormatted(todayFormatted)) {
		return '明天';
	} else {
		const month = targetDate.getMonth() + 1;
		const day = targetDate.getDate();
		return month + '月' + day + '日';
	}
}